export default {
	data() {
		return {
			fixedHeight: 0,
			tableHeight: null
		}
	},
	mounted() {
		this.autoHeight()
		window.addEventListener('resize', this.autoHeight)
	},
	destroyed() {
		window.removeEventListener('resize', this.autoHeight)
	},
	methods: {
		autoHeight: function() {
			let height = this.fixedHeight
			if (this.$refs.flexibleDom) {
				height = this.fixedHeight + this.$refs.flexibleDom.offsetHeight
			}
			this.tableHeight = Math.max(400, window.innerHeight - height)
		}
	}
}